<?php
/**
 * Created by PhpStorm.
 * User: Drunk
 * Date: 2017-1-29
 * Time: 8:11
 */


/**
 * test part >>
 */

if (!function_exists('test_handle')) {
    /**
     * 取全局打印调试句柄
     * @return mixed
     */
    function test_handle() {
        return empty($GLOBALS['drunk_test']) ? $GLOBALS['drunk_test'] = new \drunk\test : $GLOBALS['drunk_test'];
    }
}

if (!function_exists('test')) {
    /**
     * 单步打印调试
     * @return mixed
     */
    function test() {
        (new \drunk\test)->mark(debug_backtrace())->dump();
    }
}

if (!function_exists('test_mark')) {
    /**
     * 多步打印调试标记
     * @return mixed
     */
    function test_mark() {
        test_handle()->mark(debug_backtrace());
    }
}

if (!function_exists('test_mark_json')) {
    /**
     * 多步打印调试json标记
     * @return mixed
     */
    function test_mark_json() {
        test_handle()->mark(debug_backtrace(), 1);
    }
}

if (!function_exists('test_mark_php')) {
    /**
     * 多步打印调试标记
     * @return mixed
     */
    function test_mark_php() {
        test_handle()->mark(debug_backtrace(), 2);
    }
}

if (!function_exists('test_dump')) {
    /**
     * 多步打印调试输出
     * @return mixed
     */
    function test_dump() {
        $handle = test_handle();
        $handle->mark(debug_backtrace());
        $handle->dump();
    }
}

if (!function_exists('test_dump_src')) {
    /**
     * 多步打印调试输出
     * @return mixed
     */
    function test_dump_src() {
        $handle = test_handle();
        $handle->mark(debug_backtrace());
        $handle->dump(1);
    }
}

if (!function_exists('test_dump_pass')) {
    /**
     * 多步打印调试输出
     * @return mixed
     */
    function test_dump_pass() {
        $handle = test_handle();
        $handle->mark(debug_backtrace());
        $handle->dump(2);
    }
}

if (!function_exists('test_dump_src_pass')) {
    /**
     * 多步打印调试输出
     * @return mixed
     */
    function test_dump_src_pass() {
        $handle = test_handle();
        $handle->mark(debug_backtrace());
        $handle->dump(3);
    }
}